package cn.xshi.bpm.service.impl;
import java.util.List;
import java.util.Map;

import cn.xshi.bpm.dao.LcFormFieldDao;
import cn.xshi.bpm.service.LcFormFieldService;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import org.springframework.stereotype.Service;
import cn.xshi.bpm.model.LcFormField;
import javax.annotation.Resource;
/**
 * @Desc 工作流表单字段
 * @Author 邓纯杰
 * @CreateTime 2022-04-04 19:17:12
 */
@Service
public class LcFormFieldServiceImpl extends BaseService implements LcFormFieldService {

	@Resource
	private LcFormFieldDao lcFormFieldDao;

	/**
	 * 分页
	 * @param condition
	 * @return
	 */
	public List<LcFormField> getLcFormFieldListByCondition(Map<String,Object> condition){
		try{
			return lcFormFieldDao.getLcFormFieldListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param id
	 * @return
	 */
	public LcFormField getLcFormFieldById(String id){
		try{
			LcFormField lcFormField = lcFormFieldDao.getLcFormFieldById(id);
			return lcFormField;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param lcFormField
	 * @return
	 */
	public int addLcFormField(LcFormField lcFormField){
		int i = 0;
		try {
			lcFormField.setCreateId(getCurrentAccountId());
			lcFormField.setCreateTime(getDate());
			lcFormField.setId(toUUID());
			i = lcFormFieldDao.addLcFormField(lcFormField);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param lcFormField
	 * @return
	 */
	public int updateLcFormField(LcFormField lcFormField){
		int i = 0;
		try {
			lcFormField.setUpdateId(getCurrentAccountId());
			lcFormField.setUpdateTime(getDate());
			i = lcFormFieldDao.updateLcFormField(lcFormField);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改（根据动态条件）
	 * @param lcFormField
	 * @return
	 */
	public int updateLcFormFieldBySelective(LcFormField lcFormField){
		int i = 0;
		try {
			i = lcFormFieldDao.updateLcFormFieldBySelective(lcFormField);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delLcFormField(Map<String,Object> condition){
		int i = 0;
		try {
			i = lcFormFieldDao.delLcFormField(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}